package com.panda.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class BinaryDaoImpl implements BinaryDao {

    private RedisTemplate<String, byte[]> redisTemplate;

    @Autowired
    public void setRedisTemplate(RedisTemplate<String, byte[]> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    @Override
    public void save(String pre, byte[] body) {
        redisTemplate.opsForValue().set(pre, body);
    }

    @Override
    public byte[] get(String pre) {
        return redisTemplate.opsForValue().get(pre);
    }

}
